package com.penghaisoft.microwms.product.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.penghaisoft.microwms.common.dto.Resp;
import com.penghaisoft.microwms.common.page.Pager;
import com.penghaisoft.microwms.common.service.BaseService;
import com.penghaisoft.microwms.common.wms.model.ProCountingDifference;
import com.penghaisoft.microwms.product.dao.ProCountingDifferenceMapper;
import com.penghaisoft.microwms.product.service.IProCountingDifferenceService;


/**
 * <p>
 * 业务逻辑实现类
 * </p>
 * 
 * @author
 * @createDate 
 **/
@Service("proCountingDifferenceService")
public class ProCountingDifferenceServiceImpl extends BaseService implements IProCountingDifferenceService{
		@Resource
		private ProCountingDifferenceMapper proCountingDifferenceMapper;
		
	  /**
	   * 新增记录
	   * @param baseResource
	   * @return
	   */
		@Override
		public Resp create(ProCountingDifference proCountingDifference){
			proCountingDifferenceMapper.create(proCountingDifference);
			return success();
		}

	  /**
	   * 删除记录（逻辑删除）
	   * @param baseResource
	   * @return
	   */
		@Override
		public Resp delete(ProCountingDifference proCountingDifference){
			proCountingDifferenceMapper.delete(proCountingDifference);
			return success();
		}
		
	  /**
	   * 查询列表
	   * @param pager
	   * @param baseResource
	   * @return
	   */
		@Override
		public Pager<ProCountingDifference> findListByCondition(int page, int rows,ProCountingDifference condition){
		    Pager<ProCountingDifference> pager = new Pager<>();
		    pager.setPage(page);
		    pager.setRows(rows);
    		condition.preQuery();
			List<ProCountingDifference> records = proCountingDifferenceMapper.queryList(pager,condition);
			long size = proCountingDifferenceMapper.queryCount(condition);
			pager.setRecords(records);
			pager.setTotalCount(size);
			return pager;
		}

	  /**
	   * 查询单条
	   * @param id
	   * @return
	   */
		@Override
		public ProCountingDifference findById(String id){
			return proCountingDifferenceMapper.queryById(id);
		}
		
	  /**
	   * 修改记录
	   * @param baseResource
	   * @return
	   */
		@Override
		public Resp update(ProCountingDifference proCountingDifference){
			proCountingDifferenceMapper.updateBySelect(proCountingDifference);
			return success();
		}

}
